/*
 * @file    :task.h
 * @author  :LingFengLu
 * @date    :2023-06-08
 */

#ifndef _TASK_H_
#define _TASK_H_
#include "global.h"
#include "drv.h"
#include "message.h"
//Constant definition    宏定义
#define MILLISECOND_PER_SECOND          1000
#define TICK_PERIOD                     20
#define CLOCK_PERIOD                    2000

//Type definition    类型定义

typedef enum
{
	TASK_MESSAGE_ID_CLOCK = 0,
	TASK_MESSAGE_ID_TICK,
//	TASK_MESSAGE_ID_CLOCK1,
//	TASK_MESSAGE_ID_CLOCK2,
//	TASK_MESSAGE_ID_CLOCK3,
//	TASK_MESSAGE_ID_CLOCK4,
	TASK_COUNT_MESSAGE_ID
} task_message_id;

typedef enum
{
	TASK_PORT_SYSTEM = 0,
	TASK_PORT_COMM,
	TASK_PORT_SHELL,
	TASK_PORT_GLUCOSE,
	TASK_PORT_MONITOR = 5,
	TASK_COUNT_PORT
} task_port;

//Function declaration    函数申明
void Task_Init(void);
void Task_Process(void);
uint Task_ObtainMessageID
(
	uint *uip_MessageID
);
uint Task_HandleCommand
( 
	uint8 u8_SourcePort,
	uint8 u8_TargetPort,
	message_command *tp_Command
);
uint Task_SendMessage
(
	uint ui_MessageID,
	const uint8 *u8p_Data,
	uint ui_Length
);
void Task_EnterCritical(void);
void Task_ExitCritical(void);


//Golbal variable declaration   全局变量申明










#endif

